package common;

import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;


/**
 * Created by daihui on 16-5-17.
 */
public class iSDK_Utils {

    private static boolean sInitData = false;

    public static void init(Resources res, Context appContext, String sMainProcessName) {
        if(sInitData) {
            return;
        }
        sInitData = true;
        iSDK_Constance.mAppContext = appContext;
        iSDK_Constance.PROCESS_MASTER = sMainProcessName;
        iSDK_Constance.hasSDK_GDT = getStringIdentifier(res, sMainProcessName, "iSDK_GDT");
        iSDK_Constance.hasSDK_BeautyCenter = getStringIdentifier(res, sMainProcessName, "iSDK_BeautyCenter");
        iSDK_Constance.hasSDK_DUADCW = getStringIdentifier(res, sMainProcessName, "iSDK_DUADCW");
        iSDK_Constance.hasSDK_smToolAd = getStringIdentifier(res, sMainProcessName, "iSDK_smToolAd");
        iSDK_Constance.hasSDK_umengUpdate = getStringIdentifier(res, sMainProcessName, "iSDK_umengUpdate");

    }


    public static boolean getStringIdentifier(Resources res,String sMainProcessName,String name) {
        try {
            return !TextUtils.isEmpty(res.getString(res.getIdentifier(name, "string", sMainProcessName)));
        } catch (Exception e) {
            return false;
        }
    }
}
